{template '_header'}
<div class="page-content" style="display: block;">
    <div class="page-heading">
        <span class="pull-right">
            <a class="btn btn-primary btn-sm" href="{php echo webUrl('store.edit',array('id'=>$id));}">添加商品</a>
        </span>
        <h2>门店商品管理</h2>
    </div>

    <form action="./index.php" method="get" class="form-horizontal form-search" role="form">
        <input type="hidden" name="c" value="site">
        <input type="hidden" name="a" value="entry">
        <input type="hidden" name="m" value="mx_shop">
        <input type="hidden" name="do" value="web">
        <input type="hidden" name="r" value="goods">
        <input type="hidden" name="goodsfrom" value="sale">
        <div class="page-toolbar row m-b-sm m-t-sm">
            <div class="col-sm-4">
                <div class="input-group-btn">
                    <button class="btn btn-default btn-sm" type="button" data-toggle="refresh"><i class="fa fa-refresh"></i></button>
                    <button class="btn btn-default btn-sm" type="button" data-toggle="batch" data-href="" disabled="disabled"><i class="fa fa-circle-o"></i> 下架</button>
                    <button class="btn btn-default btn-sm" type="button" data-toggle="batch-remove" data-confirm="确认要删除吗?" data-href="" disabled="disabled"><i class="fa fa-trash"></i> 删除</button>
                </div>
            </div>
        </div>
    </form>
    <table class="table table-hover table-responsive">
        <thead class="navbar-inner">
        <tr>
            <th style="width:25px;"><input type="checkbox"></th>
            <th style="width:60px;text-align:center;">排序</th>
            <th style="width:60px;">商品</th>
            <th style="width:250px;">&nbsp;</th>

            <th style="width:90px;">价格</th>
            <th style="width:90px;">库存</th>
            <th style="width:60px;">状态</th>
            <th style="">操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $k $v}
        <tr>
            <td><input type="checkbox" value=""></td>
            <td style="text-align:center;">
                <a href="javascript:;" data-toggle="ajaxEdit" data-href="{php echo webUrl('store/goods/setdisplayorder',array('id'=>$v['id']));}">{$v['sdisplayorder']}</a>
            </td>
            <td><img src="{$v['thumb']}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"></td>
            <td class="full" style="overflow-x: hidden">
                {$v['title']}
            </td>
            <td><a href="javascript:;" data-toggle="ajaxEdit" data-href="{php echo webUrl('store/goods/setprice',array('id'=>$v['id']));}">{php echo floatval($v['smarketprice']);}</a></td>
            <td><a href="javascript:;" data-toggle="ajaxEdit" data-href="{php echo webUrl('store/goods/settotal',array('id'=>$v['id']));}">{$v['stotal']}</a></td>
            <td style="overflow:visible;">
                <span class="label {if $v['gstatus']}label-success{/if}" data-toggle="ajaxSwitch" data-confirm="{if $v['gstatus']}确认下架？{else}确认上架？{/if}" data-switch-refresh="true" data-switch-value="{$v['gstatus']}" data-switch-value0="0|下架|label label-default|{php echo webUrl('store/goods/setstatus',array('id'=>$v['id'],'status'=>0));}" data-switch-value1="1|上架|label label-success|{php echo webUrl('store/goods/setstatus',array('id'=>$v['id'],'status'=>1));}">{if $v['gstatus']}上架{else}下架{/if}</span>
            </td>
            <td style="overflow:visible;position:relative">
                <a class="btn btn-default btn-sm" data-toggle="ajaxRemove" href="{php echo webUrl('store/goods/sdelete',array('id'=>$v['id']));}" data-confirm="确认删除此商品？"><i class="fa fa-trash"></i> 删除</a>
                {if $v['hasoption']}
                <a class="btn btn-default btn-sm" href="{php echo webUrl('store/goods/goodsedit',array('id'=>$v['id']));}" title="编辑"><i class="fa fa-edit"></i> 规格</a>
                {/if}
            </td>
        </tr>
        {/loop}
        </tbody>
    </table>
</div>
{template '_footer'}